import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";

/**
 * ExportPage - 导出界面 - 将导出界面从 index.js 中提取出来
 * @date 2019/9/27
 */
import React, { Component } from 'react';
import { Col, Divider, Form, InputNumber, Row, Select, Spin, Tree, Input } from 'antd';
import intl from "../../utils/intl";
import "./index.less";

var ExportPage = /*#__PURE__*/function (_Component) {
  _inherits(ExportPage, _Component);

  var _super = _createSuper(ExportPage);

  function ExportPage() {
    _classCallCheck(this, ExportPage);

    return _super.apply(this, arguments);
  }

  _createClass(ExportPage, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          exportTypeList = _this$props.exportTypeList,
          exportList = _this$props.exportList,
          fetchColumnLoading = _this$props.fetchColumnLoading,
          formItemLayout = _this$props.formItemLayout,
          queryFormItem = _this$props.queryFormItem,
          form = _this$props.form,
          checkedKeys = _this$props.checkedKeys,
          expandedKeys = _this$props.expandedKeys,
          renderQueryForm = _this$props.renderQueryForm,
          renderTreeNodes = _this$props.renderTreeNodes,
          onExpand = _this$props.onExpand,
          onSelect = _this$props.onSelect,
          enableAsync = _this$props.enableAsync,
          _this$props$exportAsy = _this$props.exportAsync,
          exportAsync = _this$props$exportAsy === void 0 ? false : _this$props$exportAsy;
      return /*#__PURE__*/React.createElement(Spin, {
        spinning: fetchColumnLoading
      }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
        span: 12
      }, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, formItemLayout, {
        label: intl.get("cpaas.common.components.export.file").d('自定义文件名')
      }), form.getFieldDecorator('fileName', {})( /*#__PURE__*/React.createElement(Input, null)))), /*#__PURE__*/React.createElement(Col, {
        span: 12
      }, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, formItemLayout, {
        label: intl.get("cpaas.common.components.export.type").d('导出类型')
      }), form.getFieldDecorator('fillerType', {
        initialValue: exportTypeList.length > 0 ? exportTypeList[0].value : 'single-sheet'
      })( /*#__PURE__*/React.createElement(Select, null, exportTypeList.map(function (item) {
        return /*#__PURE__*/React.createElement(Select.Option, {
          value: item.value,
          key: item.value
        }, item.meaning);
      })))))), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
        span: 12
      }, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, formItemLayout, {
        label: intl.get("cpaas.common.components.export.async").d('异步')
      }), form.getFieldDecorator('async', {
        initialValue: 'false'
      })( /*#__PURE__*/React.createElement(Select, {
        disabled: !exportAsync || !enableAsync
      }, /*#__PURE__*/React.createElement(Select.Option, {
        value: "false",
        key: "false"
      }, intl.get('cpaas.common.status.no').d('否')), /*#__PURE__*/React.createElement(Select.Option, {
        value: "true",
        key: "true"
      }, intl.get('cpaas.common.status.yes').d('是')))))), /*#__PURE__*/React.createElement(Col, {
        span: 12
      }, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, formItemLayout, {
        label: intl.get("cpaas.common.components.export.maxSheet").d('最大sheet页')
      }), form.getFieldDecorator('singleExcelMaxSheetNum', {})( /*#__PURE__*/React.createElement(InputNumber, {
        min: 1,
        precision: 0,
        style: {
          width: '114px'
        }
      }))))), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
        span: 12
      }, /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, formItemLayout, {
        label: intl.get("cpaas.common.components.export.singleSheet").d('单sheet最大数量')
      }), form.getFieldDecorator('singleSheetMaxRow', {})( /*#__PURE__*/React.createElement(InputNumber, {
        min: 1,
        precision: 0,
        style: {
          width: '114px'
        }
      }))))))), /*#__PURE__*/React.createElement(Divider, null), queryFormItem && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
        style: {
          margin: '12px auto'
        }
      }, intl.get("cpaas.common.components.export.condition").d('设置导出条件')), renderQueryForm()), /*#__PURE__*/React.createElement("div", {
        style: {
          margin: '12px auto'
        }
      }, intl.get("cpaas.common.components.export.columns").d('选择要导出的列')), /*#__PURE__*/React.createElement(Tree, {
        checkable: true,
        onExpand: onExpand,
        expandedKeys: expandedKeys,
        defaultExpandedKeys: expandedKeys,
        onCheck: onSelect,
        checkedKeys: checkedKeys
      }, renderTreeNodes(exportList)));
    }
  }]);

  return ExportPage;
}(Component);

export { ExportPage as default };